
#ifndef CUDNN_SPATIALTF_HPP
#define CUDNN_SPATIALTF_HPP

#include "cudnn.h"

#include "common/spatialtf_pd.hpp"
#include "gpu/gpu_primitive.hpp"
#include "gpu/nvidia/cudnn_spatialtf_impl.hpp"
#include "gpu/nvidia/engine.hpp"
#include "gpu/nvidia/sycl_cuda_utils.hpp"

namespace dnnl {
namespace impl {
namespace gpu {
namespace nvidia {

struct cudnn_spatialtf_grid_generator_fwd_t : public gpu::primitive_t {
    using gpu::primitive_t::primitive_t;

    struct pd_t : public spatialtf_gridgen_fwd_pd_t {
        using spatialtf_gridgen_fwd_pd_t::spatialtf_gridgen_fwd_pd_t;

        DECLARE_COMMON_PD_T("cuda:cudnn:any", cudnn_spatialtf_grid_generator_fwd_t);

        status_t init(impl::engine_t *engine) {
            const memory_desc_wrapper src_d(src_md());
            const memory_desc_wrapper dst_d(dst_md());

            auto sycl_dev
                    = utils::downcast<nvidia::engine_t *>(engine)->device();

            spatialtf_impl_.reset(new cudnn_spatialtf_gridgen_fwd_impl_t());

            return spatialtf_impl_->init(this);
        }

        std::shared_ptr<cudnn_spatialtf_impl_base_t> spatialtf_impl_;
    };

    status_t execute(const exec_ctx_t &ctx) const override;

private:
    const pd_t *pd() const { return (const pd_t *)primitive_t::pd().get(); }
};


} // namespace nvidia
} // namespace gpu
} // namespace impl
} // namespace dnnl


#endif //CUDNN_SPATIALTF_HPP
